package operation.impl;

import book.BookList;
import operation.IOperation;

public class BorrowOperation implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("请输入要借的书籍名称:");
        String bookName = scanner.next();
        if (bookList.isContains(bookName)) {
            if (!bookList.isBookBorrowed(bookName)) {
                bookList.borrowBook(bookName);
                System.out.println("借书成功!");
            }else {
                System.err.println("该书已借出!");
            }
        }else {
            System.err.println("图书馆不存在该书籍!");
        }
    }
}
